<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html>
<head>
    <meta name="renderer" content="webkit">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="canonical" href="http://ishare.iask.sina.com.cn/c/1899.html"/>
    <script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="/js/jquery.reveal.min.js"></script>
    <script type="text/javascript" src="/js/common.min.js"></script>
    <script src="/js/ds.js"></script>
    <script src="/js/messenger.min.js"></script>
    <script type="text/javascript" src="https://static.iask.cn/libjs/fix/mobile.verification.plug.min.js"></script>
    <script type="text/javascript" src="/js/beta.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://static3.iask.cn/v20180321/css/iAsk.login.min.css">
    <script type="text/javascript" src="https://static.iask.cn/libjs/fix/messenger.min.js"></script>
    <script type="text/javascript" src="/js/common.login.plug.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/iShare_base.min.css">
    <link rel="stylesheet" type="text/css" href="/css/iShare_list.min.css">
    <script type="text/javascript" src="/js/jquery.jcarousellite.min.js"></script>
    <script type="text/javascript" src="/js/json2.min.js"></script>
    <script type="text/javascript" src="/js/public.min.js"></script>
    <script type="text/javascript" src="/js/iShare.min.js"></script>
    <script type="text/javascript" src="/js/dialog.js"></script>
    <script type="text/javascript" src="/js/ajaxfileupload.js"></script>
    <script type="text/javascript">
        var _hmt = _hmt || [];
        try {
            (function () {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?17cdd3f409f282dc0eeb3785fcf78a66";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
            _hmt.push(['_setAccount', '17cdd3f409f282dc0eeb3785fcf78a66']);
            (function () {
                var myDate = new Date();
                myDate.setTime(-1000);//设置时间
                document.cookie = "ishareHistory=''; expires=" + myDate.toGMTString();
            })();
        } catch (e) {
        }
    </script>
    <script type="text/javascript" src="http://static3.iask.cn/v20180321/js/baidu-statistics.min.js"></script>
    <style type="text/css">
        .sogou_sugg_feedbackquan {
            display: none !important;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="http://static3.iask.cn/v20180321/css/channel.min.css">
    <script type="text/javascript" src="http://static3.iask.cn/v20180321/js/category.min.js"></script>
</head>
<body>
<div class="top-bar cf">
    <div class="fr">
        <div class="user-info"><em style="margin-left: -40px">您好！</em>
            <c:choose>
                <c:when test='${sessionScope.get("user") == null}'>
                    <a class="login-link" href='/jsp/login.jsp' >请登录</a>
                </c:when>
                <c:otherwise>
                    <div class="user-info" style="display:block;">
                        <div class="user-name fl" id="J_user_name">
                            <a href="#">
                                <div class="user-img fl">
                                    <img src="/images/headimg/${sessionScope.get('user').photo}" width="20" height="20">
                                </div>
                                <p class="name">${sessionScope.get("user").nickname}</p>
                                <i class="icon icon-arrow"></i>
                            </a>
                            <div class="user-nav">
                                <p><a id="my-info">我的资料</a></p>
                                <p><a id="modify-password">修改密码</a></p>
                                <p><a href="/user/log_out" class="exit" id="exit"><i class="icon icon-exit"></i>退出</a></p>
                            </div>
                        </div>
                    </div>
                </c:otherwise>
            </c:choose>
        </div>

    </div>
</div>

<div id="common_dialog" class="dialog">
    <a  title="关闭" class="close">关闭</a>
    <div class="dialog-con">
        <h2 name="title">我的信息</h2>
        <div class="dialog-btn-con">
            <span id="uId" style="display: none">${requestScope.get("user").uId}</span>
            <ul class="persion-info">
                <li style="margin-top: 0px">
                    <span for="account">账户:</span>
                    <input class="input-text" id="account" type="text"  disabled="disabled" value="${sessionScope.get('user').account}"/>
                </li>
                <li>
                    <span for="nickname">昵称:</span>
                    <input class="input-text" id="nickname" type="text" value="${sessionScope.get('user').nickname}"/>
                </li>
                <li>
                    <label for="email">邮箱:</label>
                    <input class="input-text" id="email" type="text" value="${sessionScope.get('user').emial}"/>
                </li>
                <li>
                    <input type="button" id="ok-change-info" class="btn" value="确认修改信息"/>
                </li>
            </ul>
            <div class="persion-img" style="margin-left: 30px;">
                <div style="width: 150px;margin-left: 30px;float: left">
                    <img id="headimg" src="/images/headimg/${sessionScope.get('user').photo}" style="width: 150px;height: 150px;"/>
                    <input id="change-headimg"  class="btn" type="button" value="修改头像" style="margin-top: 10px;">
                </div>
                <div id="change-div" style="width:150px;float: left;margin-left: 10px;display: none">
                    <input id="file" name="file" type="file" style="margin-top: 30px;">
                    <input id="ok-change-headimg" class="btn" type="button" value="确认修改" style="margin-top: 30px;">
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<div id="forbidDialog" class="dialog">
    <a href="javascript:void(0);" class="close" title="关闭">关闭</a>
    <div class="dialog-con">
        <h2>修改密码</h2>
        <div class="block-con">
            <ul >
                <li>
                    <span for="oldpassword">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;旧密码:</span>
                    <input class="input-text" id="oldpassword" type="password" />
                </li>
                <li style="margin-top: 20px">
                    <span for="newpassword">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;新密码:</span>
                    <input class="input-text" id="newpassword" type="password" />
                </li>
                <li style="margin-top: 20px">
                    <label for="con-password">确认新密码:</label>
                    <input class="input-text" id="con-password" type="password" />
                </li>
            </ul>
        </div>
        <div class="dialog-btn-con btn-block">
            <a href="javascript:void(0);" id="ok-password" class="btn-dialog">确定</a>
        </div>
    </div>
</div>

<input type="hidden" id="index_banner1" value="http://static3.iask.cn/v20180321/images/index_banner1.jpg"/>
<input type="hidden" id="index_banner2" value="http://static3.iask.cn/v20180321/images/index_banner2.jpg"/>
<input type="hidden" id="login_u_name" value=""/>
<input type="hidden" id="login_u_pic" value=""/>
<input type="hidden" id="login_u_id" value=""/>
<input type="hidden" id="login_u_mobile" value=""/>
<input type="hidden" id="login_u_cflag" value=""/>
<script type="text/javascript">
    try {
        $.get("/user/checkLogin?" + Math.random(), function (data) {
            try {
                var json = $.parseJSON(data);
                if (json != null) {
                    if (json.succ == "Y") {
                        $('#login_u_name').val(json.jsonData.nickName);
                        $('#login_u_pic').val(json.jsonData.weiboImage ? json.jsonData.weiboImage : 'http://static3.iask.cn/v20180321/images/user_default.gif');
                        $('#login_u_id').val(json.jsonData.userId);
                        if (json.jsonData.mobile) $('#login_u_mobile').val(json.jsonData.mobile);
                        if (json.jsonData.cflag) $('#login_u_cflag').val(json.jsonData.cflag);
                        var usr_html = ['	<a href="/ucenter/mydownloads?u=' + json.jsonData.userId + '">',
                            '		<div class="user-img fl">',
                            '			<img src="' + (json.jsonData.weiboImage ? json.jsonData.weiboImage : 'http://static3.iask.cn/v20180321/images/user_default.gif') + '" width="20" height="20">',
                            '		</div>',
                            '		<p class="name">' + json.jsonData.nickName + '</p>',
                            '		<i class="icon icon-arrow"></i>',
                            '	</a>',
                            '	<div class="user-nav">',
                            '		<p><a href="/ucenter/myuploads?u=" target="_blank">我的上传</a></p>',
                            '		<p><a href="/ucenter/mydownloads?u=" target="_blank">我的下载</a></p>',
                            '		<p><a href="/ucenter/mycollect?u=" target="_blank">我的收藏</a></p>',
                            '		<p><a class="exit" href="javascript:;" onclick="ishareLogout();return false;"><i class="icon icon-exit"></i>退出</a></p>',
                            '	</div>'].join('');
                        $("#J_user_name").html(usr_html);
                        $(".top-bar").find(".user-info:eq(0)").hide();
                        $(".top-bar").find(".user-info:eq(1)").show();
                        window.filedetail_ajax_after_login();
                    }
                }
            } catch (e) {
            }
        });
    } catch (e) {
    }

    function showForbidDialog(content) {
        var bgMask = $("#common_bgMask").show();
        var dialog = $("#forbidDialog");
        dialog.find("p.block-txt").text(content);
        dialog.show().find("a.close,a.btn-dialog").off("click").click(function () {
            bgMask.hide();
            dialog.hide();
        });
        delCookie("cuk");
    }
</script>
<div class="header">
    <div class="pw pw-v cf">
        <a href="/jsp/index.jsp" class="logo fl"><span style="font-size: 24px;font-style: italic;font-family: 'Microsoft Yahei';color: black;">图书爱分享!</span></a>
        <div class="search-con fl">
            <div class="search-input-con">
                <div class="search-input-box fl">
                    <input id="scondition" type="text" class="search-input " value="" maxlength="20"/></div>
                <a  class="btn-search" id="searchBtn"><i
                        class="icon-iShare"></i>搜索</a>
                <%--图书搜索js--%>
                <script>
                    $("#searchBtn").click(function () {
                        var bookName = $("#scondition").val();
                        if(bookName == ""){
                            alert("请输入搜索条件");
                            return;
                        }
                        $("#booklist").empty();
                        getBookbySearch(1,bookName);
                    })
                    function getBookbySearch(pageNum,bookName) {
                        $.get("/get_book_by_name_author?pageNum="+pageNum+"&pageSize=10&bookName="+bookName,function (result) {
                            var json = result.obj;
                            if(json.total == 0){
                                $("#booklist").append('<h2>没有搜索收到符合条件的书籍</h2>');
                                return;
                            }
                            var list = json.list;
                            for (var i = 0; i < list.length; i++) {
                                $("#booklist").append(' <tr>\n' +
                                    '                        <td>\n' +
                                    '                            <p class="list-text"><i class="ico-data ico-'+list[i].format+'"></i>\n' +
                                    '                            <a href="/into_bookInfo?bookId='+list[i].bookId+'"  target="_blank" >' + list[i].bookName + '</a></p>\n' +
                                    '                        </td><td><a class="user-name">' + list[i].bookAnthou + '</a></td>\n' +
                                    '                        <td><a class="user-name">' + list[i].user.nickname + '</a></td>\n' +
                                    '                        <td class="text-center">' + list[i].score + '</td>' +
                                    '                        <td class="text-center">' + list[i].downloadNumber + '</td>\n' +
                                    '                        <td class="text-center">2018-03-29</td>\n' +
                                    '                    </tr>')
                            }
                            $("#page_con").empty();
                            for(var i=1;i<=json.pages;i++){
                                if( i == json.pageNum){
                                    $("#page_con").append('<a class="current" onclick="getBookbySearch('+i+')">'+i+'</a>');
                                }else {
                                    $("#page_con").append('<a onclick="getBookbySearch('+i+')">'+i+'</a>');
                                }
                            }
                            if(json.hasNextPage) {
                                $("#page_con").append(' <a class="btn-page" onclick="getBookbySearch(' + json.nextPage + ')">下一页</a>\n' +
                                    '                    <a class="max-page" onclick="getBookbySearch(' + json.lastPage + ')">尾页</a>')
                            }else {
                                $("#page_con").append(' <a class="btn-page" style="background: grey;">下一页</a>\n' +
                                    '                    <a class="max-page" style="background: grey;">尾页</a>')
                            }
                        })
                    }
                </script>
                <div id="lately-search" class="lately-search" style="display: none;">
                    <ul class="lately-list">
                        <li><a href="javascript:;">搜索内容</a></li>
                        <li><a href="javascript:;">搜索内容</a></li>
                        <li><a href="javascript:;">搜索内容</a></li>
                        <li><a href="javascript:;">搜索内容</a></li>
                    </ul>
                </div>
            </div>
            <div class="tui-header">
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $("div.header").css("background", "#eee");
</script>
<style>.hide {
    display: none !important;
}</style>
<input type="hidden" id="ip-page-type" value="pcat"/>
<div class="pw mt20">
    <div class="crumb cf">
        <a href="/into_view_source?cId=${requestScope.get("parent_category").cId}">${requestScope.get("parent_category").cName}</a>
        <c:if test="${requestScope.get('category') != null }">
            <i class="crumb-arrow crumb-arrow-left"></i>
            <div class="crumb-more">
                <strong>${requestScope.get('category').cName}</strong>
            </div>
        </c:if>
    </div>
    <%--分类列表--%>
    <form id="form">
        <div class="education-attribute mt10">
            <div class="education-attribute-nav">
                <ul class="cf">
                    <c:forEach items="${requestScope.get('categoryList')}" var="item">
                        <c:choose>
                            <c:when test="${item.cId == requestScope.get('category').cId}">
                                <li class="current"><a href="/into_view_source?cId=${item.cId}">${item.cName}</a></li>
                            </c:when>
                            <c:otherwise>
                                <li class=""><a href="/into_view_source?cId=${item.cId}">${item.cName}</a></li>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>
                </ul>
            </div>
        </div>

           <%--搜索结果列表--%>
            <div class="fl" style="width: 1160px">
                <table class="list-table mt20" cellpadding="0">
                    <thead>
                    <tr>
                        <td width="336">格式/书名</td>
                        <td width="103">作者</td>
                        <td width="103">上传者</td>
                        <td class="text-center" width="55">评分</td>
                        <td class="text-center f-order" width="114" name="1899-all-download"><span class="short-link ">下载次数<i
                                class="icon-iShare"></i></span></td>
                        <td class="text-center f-order" name="1899-all-time"><span class="short-link short-link-choose">上传时间<i
                                class="icon-iShare"></i></span></td>
                    </tr>
                    </thead>
                    <tbody id="booklist">
                    <script>
                        //获得url的参数
                        function getParam(key){
                            // 获取参数
                            var url = window.location.search;
                            // 正则筛选地址栏
                            var reg = new RegExp("(^|&)"+ key +"=([^&]*)(&|$)");
                            // 匹配目标参数
                            var result = url.substr(1).match(reg);
                            //返回参数值
                            return result ? decodeURIComponent(result[2]) : null;
                        }

                        //根据首页跳转，获取url中的搜索内容进行搜索
                        if (getParam("key") != null){
                            var bookName = getParam("key");
                            getBookbySearch(1,bookName);
                        }

                        //根据分类搜索数据
                        function getBookListByCategory(pageNum) {
                            $.get("/get_book_by_type?pageNum="+pageNum+"&pageSize=10&typeID="+getParam("cId"),function (result) {
                                var json = JSON.parse(result);
                                if(json.total == 0){
                                    $("#booklist").html('<h2>该分类下还没有上传的书籍</h2>');
                                    return;
                                }
                                $("#booklist").empty();
                                var list = json.list;
                                //添加搜索结果列表
                                for (var i=0;i<list.length;i++){
                                    $("#booklist").append(' <tr>\n' +
                                        '                        <td>\n' +
                                        '                            <p class="list-text"><i class="ico-data ico-'+list[i].format+'"></i>\n' +
                                        '                            <a href="/into_bookInfo?bookId='+list[i].bookId+'" target="_blank" >'+list[i].bookName+'</a></p>\n' +
                                        '                        </td><td><a class="user-name">'+list[i].bookAnthou+'</a></td>\n' +
                                        '                        <td><a class="user-name">'+list[i].user.nickname+'</a></td>\n' +
                                        '                        <td class="text-center">'+list[i].score+'</td>' +
                                        '                        <td class="text-center">'+list[i].downloadNumber+'</td>\n' +
                                        '                        <td class="text-center">2018-03-29</td>\n' +
                                        '                    </tr>')
                                }

                                //添加分页信息
                                $("#page_con").empty();
                                for(var i=1;i<=json.pages;i++){
                                    if( i == json.pageNum){
                                        $("#page_con").append('<a class="current" onclick="getBookListByCategory('+i+')">'+i+'</a>');
                                    }else {
                                        $("#page_con").append('<a onclick="getBookListByCategory('+i+')">'+i+'</a>');
                                    }
                                }
                                if(json.hasNextPage){
                                    $("#page_con").append(' <a class="btn-page" onclick="getBookListByCategory('+json.nextPage+')">下一页</a>\n' +
                                        '                    <a class="max-page" onclick="getBookListByCategory('+json.lastPage+')">尾页</a>')
                                }else {
                                    $("#page_con").append(' <a class="btn-page" style="background: grey;">下一页</a>\n' +
                                        '                    <a class="max-page" style="background: grey;">尾页</a>')
                                }
                            })
                        }
                        if (getParam("cId") != null){
                            getBookListByCategory(1);
                        }
                    </script>
                    </tbody>
                </table>
                <div id="page_con" class="page-con mt25">
                    <input type="hidden" value="time" id="orderId"/>
                </div>
                </div>
            </div>
    </form>
</div>
</div>
<div class="footer-con mt30">
    <div class="pw footer">
        <div class="copy-con">
            <p class="footer-nav">
                <a href="/agreement.html" rel="nofollow" target="_blank">网站声明</a>
                <a href="/infringement.html" rel="nofollow" target="_blank">侵权处理</a>
                <a href="https://iask.sina.com.cn/helpCenter/ishare.html" rel="nofollow" target="_blank">帮助中心</a>
                <a href="https://iask.sina.com.cn" target="_blank">爱问首页</a>
                <a href="/sitemap.html" target="_blank">网站地图</a>
                <a href="/feedAndComp/userFeedback" class="user-feedback" target="_blank">意见反馈</a>
            </p>
            <p class="copy-txt">Copyright &copy; 1996-2017 IASK Corporation, All Right Reserved</p>
        </div>
    </div>
</div>
<div class="fix-right">
    <a href="javascript:void(0);" class="fix-item back-top" id="backToTop"><i class="icon-iShare"></i>
        <p>返回<br>顶部</p></a>
</div>
<div style="display: none;">
    <script src="http://s11.cnzz.com/stat.php?id=1257407067&web_id=1257407067" language="JavaScript"></script>
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?7315ee476767b051b048995560f807f0";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</div>
<script type="text/javascript" src="http://static3.iask.cn/v20180321/js/foot.min.js"></script>
</body>
</html>
